<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Carousel 走马灯 | MyUI 4.x</title>
    <meta name="generator" content="VuePress 1.7.1">
    <link rel="icon" href="/my/favicon.ico">
    <script>
      var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?c4e5f73318b5cb0c389e3d9a05f831cc";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
    <meta name="description" content="MyUI是美亚柏科旗下新德汇出品的Web前端一站式项目工程框架，专注于公检法行业中台系统快速搭建，框架已在多个项目实战检验。">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">
    
    <link rel="preload" href="/my/assets/css/0.styles.82a18d97.css" as="style"><link rel="preload" href="/my/assets/js/app.fc4964fc.js" as="script"><link rel="preload" href="/my/assets/js/513.edb84f11.js" as="script"><link rel="preload" href="/my/assets/js/1327.34fefcaa.js" as="script"><link rel="preload" href="/my/assets/js/958.935c6658.js" as="script">
    <link rel="stylesheet" href="/my/assets/css/0.styles.82a18d97.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/my/" class="home-link router-link-active"><img src="/my/img/logo.png" alt="MyUI 4.x" class="logo"> <span class="site-name can-hide">MyUI 4.x</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/my/guide/" class="nav-link">
  指南
</a></div><div class="nav-item"><a href="/my/ui/components/" class="nav-link">
  组件
</a></div><div class="nav-item"><a href="/my/ui/charts/" class="nav-link">
  图表
</a></div><div class="nav-item"><a href="/my/ui/map/" class="nav-link">
  地图
</a></div><div class="nav-item"><a href="/my/ui/go/" class="nav-link">
  关系图
</a></div><div class="nav-item"><a href="/my/ui/icon/" class="nav-link">
  图标
</a></div><div class="nav-item"><a href="/my/ui/pages/" class="nav-link">
  页面
</a></div><div class="nav-item"><a href="http://newgateway.gitee.io/my-web/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  演示
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="JSDoc" class="dropdown-title"><span class="title">JSDoc</span> <span class="arrow down"></span></button> <button type="button" aria-label="JSDoc" class="mobile-dropdown-title"><span class="title">JSDoc</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/my/api/components.html" class="nav-link">
  基础组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/utils.html" class="nav-link">
  工具函数
</a></li><li class="dropdown-item"><!----> <a href="/my/api/charts.html" class="nav-link">
  图表组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/map.html" class="nav-link">
  地图组件
</a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/my/guide/" class="nav-link">
  指南
</a></div><div class="nav-item"><a href="/my/ui/components/" class="nav-link">
  组件
</a></div><div class="nav-item"><a href="/my/ui/charts/" class="nav-link">
  图表
</a></div><div class="nav-item"><a href="/my/ui/map/" class="nav-link">
  地图
</a></div><div class="nav-item"><a href="/my/ui/go/" class="nav-link">
  关系图
</a></div><div class="nav-item"><a href="/my/ui/icon/" class="nav-link">
  图标
</a></div><div class="nav-item"><a href="/my/ui/pages/" class="nav-link">
  页面
</a></div><div class="nav-item"><a href="http://newgateway.gitee.io/my-web/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  演示
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="JSDoc" class="dropdown-title"><span class="title">JSDoc</span> <span class="arrow down"></span></button> <button type="button" aria-label="JSDoc" class="mobile-dropdown-title"><span class="title">JSDoc</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/my/api/components.html" class="nav-link">
  基础组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/utils.html" class="nav-link">
  工具函数
</a></li><li class="dropdown-item"><!----> <a href="/my/api/charts.html" class="nav-link">
  图表组件
</a></li><li class="dropdown-item"><!----> <a href="/my/api/map.html" class="nav-link">
  地图组件
</a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Basic</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Form</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Data</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Notice</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Navigation</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Others</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/my/element/backtop.html" class="sidebar-link">Backtop 回到顶部</a></li><li><a href="/my/element/calendar.html" class="sidebar-link">Calendar calendar</a></li><li><a href="/my/element/card.html" class="sidebar-link">Card 卡片</a></li><li><a href="/my/element/carousel.html" aria-current="page" class="active sidebar-link">Carousel 走马灯</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/my/element/carousel.html#基础用法" class="sidebar-link">基础用法</a></li><li class="sidebar-sub-header"><a href="/my/element/carousel.html#指示器" class="sidebar-link">指示器</a></li><li class="sidebar-sub-header"><a href="/my/element/carousel.html#切换箭头" class="sidebar-link">切换箭头</a></li><li class="sidebar-sub-header"><a href="/my/element/carousel.html#卡片化" class="sidebar-link">卡片化</a></li><li class="sidebar-sub-header"><a href="/my/element/carousel.html#方向" class="sidebar-link">方向</a></li><li class="sidebar-sub-header"><a href="/my/element/carousel.html#carousel-attributes" class="sidebar-link">Carousel Attributes</a></li><li class="sidebar-sub-header"><a href="/my/element/carousel.html#carousel-events" class="sidebar-link">Carousel Events</a></li><li class="sidebar-sub-header"><a href="/my/element/carousel.html#carousel-methods" class="sidebar-link">Carousel Methods</a></li><li class="sidebar-sub-header"><a href="/my/element/carousel.html#carousel-item-attributes" class="sidebar-link">Carousel-Item Attributes</a></li></ul></li><li><a href="/my/element/collapse.html" class="sidebar-link">Collapse 折叠面板</a></li><li><a href="/my/element/dialog.html" class="sidebar-link">Dialog 对话框</a></li><li><a href="/my/element/divider.html" class="sidebar-link">Divider 分割线</a></li><li><a href="/my/element/drawer.html" class="sidebar-link">Drawer 抽屉</a></li><li><a href="/my/element/image.html" class="sidebar-link">Image 图片</a></li><li><a href="/my/element/infiniteScroll.html" class="sidebar-link">InfiniteScroll 无限滚动</a></li><li><a href="/my/element/popconfirm.html" class="sidebar-link">Popconfirm 气泡确认框</a></li><li><a href="/my/element/popover.html" class="sidebar-link">Popover 弹出框</a></li><li><a href="/my/element/timeline.html" class="sidebar-link">Timeline 时间线</a></li><li><a href="/my/element/tooltip.html" class="sidebar-link">Tooltip 文字提示</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="carousel-走马灯"><a href="#carousel-走马灯" class="header-anchor">#</a> Carousel 走马灯</h1> <p>在有限空间内，循环播放同一类型的图片、文字等内容</p> <h2 id="基础用法"><a href="#基础用法" class="header-anchor">#</a> 基础用法</h2> <p>适用广泛的基础用法</p> <!----><h2 id="指示器"><a href="#指示器" class="header-anchor">#</a> 指示器</h2> <p>可以将指示器的显示位置设置在容器外部</p> <!----><h2 id="切换箭头"><a href="#切换箭头" class="header-anchor">#</a> 切换箭头</h2> <p>可以设置切换箭头的显示时机</p> <!----><h2 id="卡片化"><a href="#卡片化" class="header-anchor">#</a> 卡片化</h2> <p>当页面宽度方向空间空余，但高度方向空间匮乏时，可使用卡片风格</p> <!----><h2 id="方向"><a href="#方向" class="header-anchor">#</a> 方向</h2> <p>默认情况下，<code>direction</code> 为 <code>horizontal</code>。通过设置 <code>direction</code> 为 <code>vertical</code> 来让走马灯在垂直方向上显示。</p> <!----><h2 id="carousel-attributes"><a href="#carousel-attributes" class="header-anchor">#</a> Carousel Attributes</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>可选值</th> <th>默认值</th></tr></thead> <tbody><tr><td>height</td> <td>走马灯的高度</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>initial-index</td> <td>初始状态激活的幻灯片的索引，从 0 开始</td> <td>number</td> <td>—</td> <td>0</td></tr> <tr><td>trigger</td> <td>指示器的触发方式</td> <td>string</td> <td>click</td> <td>—</td></tr> <tr><td>autoplay</td> <td>是否自动切换</td> <td>boolean</td> <td>—</td> <td>true</td></tr> <tr><td>interval</td> <td>自动切换的时间间隔，单位为毫秒</td> <td>number</td> <td>—</td> <td>3000</td></tr> <tr><td>indicator-position</td> <td>指示器的位置</td> <td>string</td> <td>outside/none</td> <td>—</td></tr> <tr><td>arrow</td> <td>切换箭头的显示时机</td> <td>string</td> <td>always/hover/never</td> <td>hover</td></tr> <tr><td>type</td> <td>走马灯的类型</td> <td>string</td> <td>card</td> <td>—</td></tr> <tr><td>loop</td> <td>是否循环显示</td> <td>boolean</td> <td>-</td> <td>true</td></tr> <tr><td>direction</td> <td>走马灯展示的方向</td> <td>string</td> <td>horizontal/vertical</td> <td>horizontal</td></tr></tbody></table> <h2 id="carousel-events"><a href="#carousel-events" class="header-anchor">#</a> Carousel Events</h2> <table><thead><tr><th>事件名称</th> <th>说明</th> <th>回调参数</th></tr></thead> <tbody><tr><td>change</td> <td>幻灯片切换时触发</td> <td>目前激活的幻灯片的索引，原幻灯片的索引</td></tr></tbody></table> <h2 id="carousel-methods"><a href="#carousel-methods" class="header-anchor">#</a> Carousel Methods</h2> <table><thead><tr><th>方法名</th> <th>说明</th> <th>参数</th></tr></thead> <tbody><tr><td>setActiveItem</td> <td>手动切换幻灯片</td> <td>需要切换的幻灯片的索引，从 0 开始；或相应 <code>el-carousel-item</code> 的 <code>name</code> 属性值</td></tr> <tr><td>prev</td> <td>切换至上一张幻灯片</td> <td>—</td></tr> <tr><td>next</td> <td>切换至下一张幻灯片</td> <td>—</td></tr></tbody></table> <h2 id="carousel-item-attributes"><a href="#carousel-item-attributes" class="header-anchor">#</a> Carousel-Item Attributes</h2> <table><thead><tr><th>参数</th> <th>说明</th> <th>类型</th> <th>可选值</th> <th>默认值</th></tr></thead> <tbody><tr><td>name</td> <td>幻灯片的名字，可用作 <code>setActiveItem</code> 的参数</td> <td>string</td> <td>—</td> <td>—</td></tr> <tr><td>label</td> <td>该幻灯片所对应指示器的文本</td> <td>string</td> <td>—</td> <td>—</td></tr></tbody></table></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/my/element/card.html" class="prev">
        Card 卡片
      </a></span> <span class="next"><a href="/my/element/collapse.html">
        Collapse 折叠面板
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"></div></div>
    <script src="/my/assets/js/app.fc4964fc.js" defer></script><script src="/my/assets/js/513.edb84f11.js" defer></script><script src="/my/assets/js/1327.34fefcaa.js" defer></script><script src="/my/assets/js/958.935c6658.js" defer></script>
  </body>
</html>
